package com.test.test;

import java.io.UnsupportedEncodingException;
import java.util.Arrays;

public class TTT
{
	// TODO:值确定？？？？byte 有符号
	static final byte NOAH_FLAG_IMG = (byte) 0xB5;

	static String str = "根据【1】 专有名词 " + "根据意义,名词可分为专有名词和普通名词。";

	int a;
	int a45;
	int x;
	int a4545;

	/**
	 * desp：
	 * 
	 * @param args
	 */
	public static void main(String[] args)
	{
		// int ui = 10 * 1024 *1024 ;
		// System.out.println(ui);
		//		
		// byte by_tt = (byte)0xA2 ;
		// //byte by = (byte)D9 ;
		// System.out.println(by_tt);
		//		
		// long begin = System.currentTimeMillis() ;
		// byte by = (byte)0xDA ;
		//        
		// System.out.println( "beging:"+begin );
		// // System.out.println(byteToHex((byte) 13));
		// // System.out.println("==="+Integer.valueOf(byteToHex((byte)13),16));
		// System.out.println("--"+((int)by & 0xFF));
		// System.out.println("time:"+(System.currentTimeMillis() - begin) );


		// tt3();

		// byte[] srcArray = new byte[] { (byte) 0x54, (byte) 0x54, (byte) 0x54,
		// (byte) 0xA1, (byte) 0xBE, (byte) 0x2F, (byte) 0xD7,
		// (byte) 0xA2, (byte) 0xD2, (byte) 0xE2, (byte) 0xA1, (byte) 0xBF };
		//
		// byte[] resArray = Arrays.copyOf(srcArray, srcArray.length-9);
		//
		// boolean result = Arrays.equals(srcArray, resArray);
		// System.out.println("src==" + srcArray.length + " ----- resArray"
		// + resArray.length);

		// System.out.println(Math.floor(8.6));

		// testStringAndChar();

		// testChar();

		// testArray();

		// testByteCopute();
		//		
		//		
		// byte[][] contentArray;
		// contentArray = new byte[26][1024];
		// contentArray[0]= new byte[]{0x10,0x20,0x50};
		// contentArray[1] = new byte[]{0x45,0x45,0x50,0x65};
		//		
		// System.out.println(contentArray.length);
		// System.out.println(contentArray[0].length);

		
//		{
//			int sum = 0 ;
//			int i = 0 ;
//			while(i< 10){
//				sum += i ;
//			}
//		}
//		while(i >2){
//			//
//		}
	}

	private static void tt3()
	{
		byte[] array = null;
		String str = "Unit 1 英语语法概要 1-1 英语语言";

		String str_span = "\r\n";
		byte[] array_span = null;
		try
		{
			array_span = str_span.getBytes("GBK");
			for (byte tb : array_span)
			{
				System.out.print(tb + " ");
			}

			array = str.getBytes("GBK");
			@SuppressWarnings("unused")
			int i = 0;
		}
		catch (UnsupportedEncodingException e)
		{
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

	public static String byteToHex(byte b)
	{
		int i = b & 0xFF;
		return Integer.toHexString(i);
	}

	/**
	 * char byte int
	 * desp：
	 */
	private static void testChar()
	{
		// //char
		char letter = 'a';
		if (letter == 97)
		{
			System.out.println("==97");
			System.out.println('a' + "\t" + (int) letter);// /可以int转型
		}

		// /byte
		byte by = (byte) 0xBF;
		if (by == 0xBF)
		{
			System.out.println("== 0xBF");
		}
		if (by == (byte) 0xBF)
		{
			System.out.println("== (byte)0xBF)");
			System.out.println(by + "\t" + (byte) by + "\t");
		}
		if (by == Integer.parseInt(String.format("%x", by), 16))
		{
			System.out
					.println("== Integer.parseInt(String.format(\"%x\", by),16)");
		}
	}

	private static void testArray()
	{
		byte[] tArray = new byte[10];
		tArray[0] = (byte) 12;
		tArray[1] = (byte) 10;

		System.out.println(tArray.length);

		int i = 0;
		while (tArray[i] != 0)
		{
			System.out.println(tArray[i]);
			i++;
		}
		;

	}

	public static void testStringAndChar()
	{
		String text = "abcdefghijklmnopqrstu";

		text += "【1】表示人的名词\n\r的性阳性 阴性man 男人 woman 女人 oy 男孩 girl 女孩father 父亲 mother 母亲brother 兄弟 sister 姐妹grandfather祖父 grandmother 祖母"
				+ "nephew侄子 ni子king 国王 queen王后emperor 皇帝 empress 女皇帝, 皇后";

		for (int i = 0; i < text.length(); i++)
		{
			if (text.charAt(i) == '\n' || text.charAt(i) == '\r')
			{
				continue;
			}
			System.out.print(text.charAt(i));
		}

		String str2 = "表示人的名词的性阳性阴性man男人";
		System.out.println();
		System.out.println(str2.length());
		for (int i = 0; i < str2.length(); i++)
		{
			if (str2.charAt(i) == '\n' || str2.charAt(i) == '\r')
			{
				continue;
			}
			System.out.print(str2.charAt(i));
		}

	}

	/**
	 * 
	 * desp：byte 操作
	 * 
	 */
	private static void testByteCopute()
	{
		System.out.println("int flag==" + NOAH_FLAG_IMG);
		System.out.println("int 形式===" + new Integer(NOAH_FLAG_IMG).toString());
		System.out.printf("格式化：%x\n", NOAH_FLAG_IMG);
		// System.out.println(Integer.toHexString(75));
		// System.out.println(Integer.toHexString(130));
		System.out.println("格式化(x%):" + String.format("%x", NOAH_FLAG_IMG));
		System.out.println("无符号int::"
				+ Integer.parseInt(String.format("%x", NOAH_FLAG_IMG), 16));

		System.out.println("flag==" + Integer.toHexString(NOAH_FLAG_IMG));
		System.out
				.println("flag==" + Integer.toHexString((byte) NOAH_FLAG_IMG));

		// ////////////////////////////
		int index = 0;
		for (; index < str.length(); index++)
		{
			System.out.print(str.charAt(index));
		}
		;

		byte[] b = new byte[] { 1, 2, 3, 4 };
		int a[] = new int[b.length];
		String tt = "";
		for (int i = 0; i < b.length; i++)
		{
			// a[i]=Integer.parseInt(String.format("%x", b[i]),16);
			tt += String.format("%x", b[i]);

			System.out.println(a[i]);
		}
		System.out.println(tt + "----" + Integer.parseInt(tt, 16));
	}

	private static void tt()
	{
		System.out.println("sdfsdf");
		int sum = 0;
		int i = 55656;
		for (int index = 454; index < 480; index++)
		{
			if (true)
			{
				return;
			}

		}
	}
}
